home *** CD-ROM | disk | FTP | other *** search
- property iCastNumOffset, inPicts, ichPict, ichButton, iCurrentValue, iCastNumNormal, iCastNumIncr, iCastNumDecr
-
- on birth me
- return me
- end
-
- on mInit me, castNumOffset, defaultVal, nPicts, chPict
- set iCastNumOffset to castNumOffset
- set inPicts to nPicts
- set ichPict to chPict
- set ichButton to ichPict + 1
- mSetValue(me, defaultVal)
- puppetSprite(ichPict, 1)
- end
-
- on mHit me
- set castNumNormal to the castNum of sprite ichButton
- set iCastNumNormal to castNumNormal
- set iCastNumIncr to castNumNormal + 1
- set iCastNumDecr to castNumNormal + 2
- set mouseDownFlag to 1
- set firstTimeFlag to 1
- repeat while mouseDownFlag
- if rollOver(ichButton) then
- if the mouseV <= the locV of sprite ichButton then
- set the castNum of sprite ichButton to iCastNumIncr
- set iCurrentValue to IncrMod(iCurrentValue, inPicts)
- else
- set the castNum of sprite ichButton to iCastNumDecr
- set iCurrentValue to DecrMod(iCurrentValue, inPicts)
- end if
- mDraw(me)
- else
- set the castNum of sprite ichButton to castNumNormal
- updateStage()
- end if
- if firstTimeFlag then
- set firstTimeFlag to 0
- wait(15)
- end if
- set mouseDownFlag to the mouseDown
- end repeat
- set the castNum of sprite ichButton to castNumNormal
- updateStage()
- return iCurrentValue
- end
-
- on mGetValue me
- return iCurrentValue
- end
-
- on mGetCastNum me, index
- return iCastNumOffset + index
- end
-
- on mSetValue me, theNewValue
- if (theNewValue < 1) or (theNewValue > inPicts) then
- alert("Bad value passed to IncrDecrCast:" && theNewValue & RETURN & "Needs to be between 1 and " & inPicts)
- return
- end if
- set iCurrentValue to theNewValue
- mDraw(me)
- updateStage()
- end
-
- on mDraw me
- set the castNum of sprite ichPict to iCastNumOffset + iCurrentValue
- updateStage()
- end
-
- on mCleanUp me
- puppetSprite(ichPict, 0)
- end
-